<% content_for :title do %>
  <%=h @label.name %>
<% end %>

<% content_for :edit do %>
  <%= link_to 'Delete Entry?', 
              new_delete_request_path(:editable_id => @label.id,
                                      :editable_type => "Label") %> |

  <%if session[:edit_mode] == false %>
    <%= link_to 'Edit This Page', edit_label_path %> 
  <% else %>
    <%= link_to 'Finish Editing', label_path %> 
  <% end %>

<% end %>

<h1><%=h @label.name %></h1>

<div id="side-info" class="group">
  
  <div id="side-info-image">
    <img src="/images/REDUX.jpg" alt="Artist Image" width="200" height="200" />
  </div><!-- /side-info-image -->

  <div id="side-info-data">  
    Name: <%=h @label.name %> <br />
    Parent Label:
    <% if @label.parent_label != nil -%>
      <%=link_to @label.parent_label.name, @label.parent_label %>
    <% end -%><br />

    Child Labels: <% if @label.child_label != nil -%>
                    <% @label.child_label.each do |child| -%>
                      <%=link_to child.name, child -%>
                    <% end -%>
                  <% end -%>
  </div><!-- /side-info-data -->
</div><!--/side-info -->

<div id="main-info" class="group">
  <div id="tab-nav">
    <ul class="tabnav">
      <li class="active">
        <%= link_to_function "Info", "$('info-pane').show(); $('discog-pane').hide(); $('forum-pane').hide(); $('artist-pane').hide();" %>
        <%= link_to_function "Discog", "$('discog-pane').show(); $('info-pane').hide(); $('forum-pane').hide(); $('artist-pane').hide();" %> 
        <%= link_to_function "ActiveArtists", "$('artist-pane').show(); $('info-pane').hide(); $('discog-pane').hide(); $('forum-pane').hide();" %>
        <%= link_to_function "Forum", "$('forum-pane').show(); $('info-pane').hide(); $('discog-pane').hide(); $('artist-pane').hide();" %>
      </li>
    </ul>
  </div><!-- /tab-nav -->

  <div id="main-info-data" class="group">
    <div id="info-pane" class="group">
      <div id="info-pane-main">

        <div id="bio">
          <h2>History</h2>
          <%= simple_format(@label.info) %>
          <br />
        </div><!-- /bio -->

        <div id="reviews">
          <h2>Reviews</h2>
          <%= render :partial => 'reviews/review', :locals => {:item => @label} %>
        </div><!-- /reviews -->

      </div><!-- /info-pane-main -->

      <div id="info-pane-sub">
  
        <div id="websites">
          <h3>Websites</h3>
          <!-- Links from the db -->
          Click Me
        </div><!-- /websites -->

        <div id="news">
          <h3>News</h3>
          News items
        </div><!-- /news -->

        <div id="edit-history">
          <h3>Edit History</h3>
          <%= link_to 'Full History for This Page', label_edits_path(@label) %>
        </div><!-- /edit-history -->


      </div><!-- /info-pane-sub -->
    </div><!-- /info-pane -->

    <div id="discog-pane" class="group" style="display :none">
    
      <h2>Discography</h2>
      <table>
   
        <tr>
          <th>Catalog ID</th>
          <th>Artist</th>
          <th>Title</th>
          <th>Year</th>
        </tr>

        <% @label.editions.each do |edition| -%>
          <tr>
            <td><%=h (edition.catalogID != nil)? edition.catalogID : "-" %></td>

            <td>
              <% edition.release.artists.each do |artist| -%>
                <%=link_to artist.name, artist %>
                <%= (artist != edition.release.artists.last)? "&" : "" %>
              <% end -%>
            </td>

            <td><%=link_to edition.title, edition.release, :edition_id => edition.id -%></td>

            <td></td>
          </tr>
        <% end -%>

      </table>
    </div><!-- /discog-pane -->

    <div id="artist-pane" class="group" style="display :none">
      <h2>Active Artists</h2>
    </div><!-- /artist-pane -->

    <div id="forum-pane" class="group"  style ="display :none">
      <h2><%=h @label.forum.title %></h2>
      <%= render :partial => 'forums/forum', :locals => {:forum => @label.forum} %>
    </div><!-- /forum-pane -->

  </div><!-- /main-info-data -->
</div><!-- /main-info -->
